function deployAndInstall() {

	echo "`date` [DEPLOY INFO] Copying install file"
	pscp -t $TIMEOUT -h $NODES -l thiagoepdc installVServer.sh /tmp/installVServer.sh
	echo "`date` [DEPLOY INFO] Copying util file"
	pscp -t $TIMEOUT -h $NODES -l thiagoepdc vserver.functions /tmp/vserver.functions
	echo "`date` [DEPLOY INFO] Copying verify installation file"
	pscp -t $TIMEOUT -h $NODES -l thiagoepdc verifyInstall.sh /tmp/verifyInstall.sh

	echo "`date` [DEPLOY INFO] Installing"
	pssh -t $TIMEOUT -h $NODES -l thiagoepdc "cd /tmp && sudo ./installVServer.sh 1> log 2> loge" 1>/dev/null 2>/dev/null
}

function usage() {

	echo "Usage: ./fullInstall.sh <nodesFile> <times-in-seconds>"
	echo "For OurGrid updates and additional information, see the "
	echo "OurGrid Project home page at http://www.ourgrid.org/ "
}

function verify() {
	echo "`date` [DEPLOY INFO] Verify Installation"
	pssh -t $TIMEOUT -h $NODES -l thiagoepdc "cd /tmp && ./verifyInstall.sh"
}

# Main
# Assign the variables
nargs=$#

if [ $nargs -eq 2 ]; then
	NODES=$1
	TIMEOUT=$2
else 
	usage
	exit 1
fi

deployAndInstall
verify 
